﻿using System.Data.Entity.ModelConfiguration;

namespace Service.Model.Map
{
    public class PlayerHeuristicMap : EntityTypeConfiguration<PlayerHeuristic>
    {
        public PlayerHeuristicMap()
        {
            ToTable("dbo.PlayerHeuristic");
            HasKey(p => new{ p.PlayerId, p.HeuristicId});

            Property(x => x.PlayerId).HasColumnName("PlayerId").IsRequired();
            Property(x => x.HeuristicId).HasColumnName("HeuristicId").IsRequired();

            HasRequired(x => x.Player).WithMany(a => a.PlayerHeuristics).HasForeignKey(ad => ad.PlayerId);
            HasRequired(x => x.Heuristic).WithMany(a => a.PlayerHeuristics).HasForeignKey(ad => ad.HeuristicId);
        }
    }
}